﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VideoCache.Server.BLL;
using DbMapping.Common;
using VideoCache.Server.Model;
using VideoCache.Server.MVCWeb.Attributes;

namespace VideoCache.Server.MVCWeb.Areas.Admin.Controllers
{
    [ActionAuthorize(AuthorizeType.Administrator)]
    public class OrderController : Controller
    {
        //
        // GET: /Admin/Order/

        public ActionResult Index(int page = 1)
        {
            int pageSize = 30;
            int recordCount = 0;

            Orders orders = new Orders();
            orders.Add(new OrderItem(OrderInfo.CreateTimeField, OrderDirection.Desc));

            var list = OrderBLL.FindPage(null, orders, page, pageSize, ref recordCount);

            ViewBag.PageSize = page;
            ViewBag.RecordCount = recordCount;

            return View(list);
        }

    }
}
